package com.iqiyi.pps.epg.web.thread;

import com.iqiyi.pps.epg.core.model.push.AutoPushMsg;
import com.iqiyi.pps.epg.core.service.push.AutoPushMsgService;
import com.iqiyi.pps.epg.core.utils.ApplicationContextUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by Administrator on 2016/7/6.
 */
public class SetAutoPushStatusThread implements Runnable {

    private static final Logger logger = LoggerFactory.getLogger(SetAutoPushStatusThread.class);
    private long startTime;
    private long endTime;

    public SetAutoPushStatusThread(long startTime, long endTime) {
        this.startTime = startTime;
        this.endTime = endTime;
    }

    @Override
    public void run() {
        // 更新剩余推送任务状态为播控下线
        int updateCount = 0;
        AutoPushMsgService autoPushMsgService = (AutoPushMsgService) ApplicationContextUtil.getBean(AutoPushMsgService.class);
        updateCount = autoPushMsgService.updatePushStatusByPushTime(startTime, endTime, AutoPushMsg.AUTO_PUSH_STATUS_OFFLINE);
        logger.info("[SetAutoPushStatusThread][Update Offline][updateCount={}]", updateCount);
    }
}
